﻿using PHMEE.ToolKits;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE
{
    /// <summary>
    /// 主机
    /// </summary>
    public class MainEngine : Equipment
    {
        protected MainEngine()
        {

        }

        public MainEngine(Guid id, Guid unitId, string name, string nameen, int number)
            : base(id, unitId, name, nameen, number)
        {

        }

        /// <summary>
        /// 缸数
        /// </summary>
        [NotMapped]
        public double CylinderNumber { get; set; }

        /// <summary>
        /// 缸径
        /// </summary>
        [NotMapped]
        public double CylinderBore { get; set; }

        /// <summary>
        /// 冲程
        /// </summary>
        [NotMapped]
        public double Stroke { get; set; }

        /// <summary>
        /// 单缸功率
        /// </summary>
        [NotMapped]
        public double PowerCylinderPer { get; set; }

        /// <summary>
        /// 支撑方式
        /// </summary>
        [NotMapped]
        public SupportFlexibilityMode SupportFlexibilityMode { get; set; }

        /// <summary>
        /// 转动方式
        /// </summary>
        [NotMapped]
        public RotationMode RotationMode { get; set; }


        public override void DeserializeProperties()
        {
            PHMEECoreHelper.SetDerivedProperties(this, DerivedPropertiesJson);
        }

        public override void SerializeProperties(Dictionary<string, object> derivedPropertiesJson)
        {
            var properties = PHMEECoreHelper.GetDerivedProperties(this);
            this.DerivedPropertiesJson = derivedPropertiesJson.Where(item => properties.Keys.Any(p => string.Equals(p, item.Key, StringComparison.OrdinalIgnoreCase))).ToDictionary();
        }
    }
}
